<?php
namespace home\Model;
use Think\Model;
class MoneyLogModel extends Model{

    public function change($user_id,$money,$type,$content){
        //var_dump($user_id);exit();
        $user = M('user')->where('id = '.$user_id)->find();

        $money_log['user_id'] = $user_id;
        $money_log['change_value'] = $money;
        $money_log['now_value'] = $user['money']+$money;
        $money_log['content'] = $content;
        $money_log['time'] = time();
        $money_log['type'] = $type;

        M('money_log')->add($money_log);

        $u['money'] = $user['money']+$money;
        M('user')->where('id = '.$user_id)->save($u);

    }
}